//
// Created by 谢哲 on 2021/5/17.
//

#include <iostream>
#include <vector>
#include <unordered_set>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T;
    cin >> T;

    for(;T;--T) {
        int n;
        cin >> n;
        unordered_set<int> sdata;
        vector<int> vdata;
        for (;n;--n) {
            int a;
            cin >> a;
            if (sdata.find(a)==sdata.end()) {
                sdata.insert(a);
                vdata.emplace_back(a);
            }
        }
        for (auto &p: vdata) cout << p << " ";
        cout << "\n";
    }

    return 0;
}